package com.fansl.koala.quickdev.module.koala.controller;

import com.fansl.koala.quickdev.common.bean.R;
import com.fansl.koala.quickdev.module.koala.service.IShareStatisticService;
import com.fansl.koala.quickdev.module.koala.vo.UserTaskInfoVo;
import com.fansl.koala.quickdev.module.koala.vo.UserVipShareInfoVo;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;

import static com.fansl.koala.quickdev.common.constants.CommonConstants.KOALA_ROOT_REQUEST_MAPPING;

/**
 * @author fansl
 * @Description: 分享统计
 * @date 2020/5/6 11:10
 */
@AllArgsConstructor
@RestController
@RequestMapping(KOALA_ROOT_REQUEST_MAPPING + "/share-statistic")
public class ShareStatisticController {
    private final IShareStatisticService shareStatisticService;

    @GetMapping("/vip-info")
    public Mono<R<UserVipShareInfoVo>> statisticVipShareInfo(@RequestParam String tel) {
        UserVipShareInfoVo userVipShareInfoVo =
                shareStatisticService.getStatisticVipShareInfo(tel);
        return Mono.just(R.ok(userVipShareInfoVo));
    }

    @GetMapping("/task-info")
    public Mono<R<UserTaskInfoVo>> taskInfo(@RequestParam Long userId,
                                            @RequestParam String taskDate) {
        UserTaskInfoVo userVipShareInfoVo =
                shareStatisticService.getUserTaskInfo(userId, taskDate);
        return Mono.just(R.ok(userVipShareInfoVo));
    }
}
